home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tchk21.arc / INCLUDE.ARC / MENUHK.H < prev    next >
C/C++ Source or Header  |  1989-06-20  |  12KB  |  174 lines

  1. /* TCHK 2.1 - Howard Kapustein's Turbo C library        6-6-89      */
  2. /* Copyright (C) 1988,1989 Howard Kapustein.  All rights reserved.  */
  3.  
  4. /* menuhk.h  -  header file for menu routines */
  5.  
  6. #ifndef MENUHK_HEADER
  7. #define MENUHK_HEADER   1
  8.  
  9. #include <howard.h>
  10. #include <video.h>
  11.  
  12. typedef struct popup_field {        /* doubly circular linked list */
  13.                 char *command;          /* ptr to command text (string) */
  14.                 int y;                  /* y-coord of command on screen */
  15.                 char flag;              /* flags, i.e. Disabled, etc. */
  16.                 char key;               /* 1-touch key */
  17.                 char offset;            /* offset of key in string */
  18.                 int retval;             /* value returned when selected ( != 0 ) */
  19.                 struct popup_header *submenu;   /* submenu (used in hierarchial menus) */
  20.                 struct popup_field *next;       /* next item in list */
  21.                 struct popup_field *previous;   /* previous item in list */
  22.             };
  23.  
  24. typedef struct popup_header {
  25.                 char *videosave;                /* ptr to saved video buffer */
  26.                 struct text_info inforec;       /* saved video info */
  27.                 int left, top, right, bottom;   /* menu coordinates */
  28.                 int margc;                      /* menu arguments */
  29.                 struct popup_field *margv;      /* ptr to list of menu args (commands) */
  30.                 struct popup_field *current;    /* current item hilited */
  31.                 char *menusave;                 /* ptr to menu video buffer */
  32.                 int colnorm;                    /* Colors:     normal */
  33.                 int colcmdkey;                              /* 1-touch command key */
  34.                 int colhilite;                              /* hilited/selected item */
  35.                 int coldisabled;                            /* disabled command */
  36.                 int coldishilite;                           /* hilited disabled item */
  37.                 unsigned flags;                 /* Flags: QEFxxxxH = Quit, ESC equals Quit, Free memory on quit, Hierarchial */
  38.                                                 /*        xDIRCEDW = DESQview free time slice, case Independent for 1-touch keys, Restore cursor before return */
  39.                                                 /*                   return don't hide Cursor, Erase menu on cleanup/free, */
  40.                                                 /*                   Disabled not hiliteable, Wraparound */
  41.                 char internal;                  /* Internal flags: xxxxxxx1 = 1st time */
  42.             };
  43.  
  44. typedef struct litebar_field {      /* doubly circular linked list (w/4-way directional) */
  45.                 char *command;          /* ptr to command text (string) */
  46.                 int x, y;               /* x/y-coord of command on screen (rel to litebar window) */
  47.                 char flag;              /* flags, i.e. Disabled, etc. */
  48.                 char key;               /* 1-touch key */
  49.                 char offset;            /* offset of key in string */
  50.                 char *message;          /* ptr to message text (string) */
  51.                 int retval;             /* value returned when selected ( != 0 ) */
  52.                 struct litebar_header *submenu;   /* submenu (used in hierarchial menus) */
  53.                 struct litebar_field *next;       /* next field */
  54.                 struct litebar_field *previous;   /* previous field */
  55.                 struct litebar_field *left;       /* left item in menu (left arrow) */
  56.                 struct litebar_field *right;      /* right item in menu (right arrow) */
  57.                 struct litebar_field *up;         /* up item in menu (up arrow) */
  58.                 struct litebar_field *down;       /* down item in menu (down arrow) */
  59.             };
  60.  
  61. typedef struct litebar_header {
  62.                 char *videosave;                /* ptr to saved video buffer */
  63.                 struct text_info inforec;       /* saved video info */
  64.                 int left, top, right, bottom;   /* litebar coordinates */
  65.                 int margc;                      /* menu arguments */
  66.                 struct litebar_field *margv;    /* ptr to list of menu args (commands) */
  67.                 struct litebar_field *current;  /* current item hilited */
  68.                 int msgx, msgy;                 /* x/y-coord for message */
  69.                 char *menusave;                 /* ptr to menu video buffer */
  70.                 struct keylist *quitkey;        /* Quitkey - leave litebar menu */
  71.                 int colnorm;                    /* Colors:     normal */
  72.                 int colcmdkey;                              /* 1-touch command key */
  73.                 int colhilite;                              /* hilited/selected item */
  74.                 int coldisabled;                            /* disabled command */
  75.                 int coldishilite;                           /* hilited disabled item */
  76.                 int colmessage;                             /* message */
  77.                 unsigned flags;                 /* Flags: QEFxxxxH = = Quit, ESC equals Quit, Free memory on quit, Hierarchial */
  78.                                                 /*        UDIRCEDW = call _idle_menu() during keyboard waits, DESQview free time slice, */
  79.                                                 /*                   case Independent for 1-touch keys, Restore cursor before return, */
  80.                                                 /*                   don't hide Cursor, Erase menu on cleanup/free, Disabled not hiliteable, */
  81.                                                 /*                   Wraparound */
  82.                 char internal;                  /* Internal flags: xxxxxxx1 = 1st time */
  83.             };
  84.  
  85. typedef struct keylist {                    /* linked list of key values (1-512) */
  86.                 int keyval;                     /* key code (1-512) */
  87.                 struct keylist *next;           /* ptr to next key */
  88.             };
  89.  
  90.                                 /* Header flags */
  91. #define QUITMENU        0x8000                /* quit */
  92. #define ESCQUIT         0x4000                /* ESC equals Quit */
  93. #define FREEMENU        0x2000                /* free memory on quit */
  94. #define HIERARCHIAL     0x0100                /* hierarchial menus */
  95. #ifndef UDFIDLE                               /* also defined in KEYBOARD.H */
  96. #define UDFIDLE         0x0080                /* call user-defined function during keyboard wait */
  97. #endif
  98. #ifndef DVFREESLICE                           /* also defined in KEYBOARD.H */
  99. #define DVFREESLICE     0x0040                /* free time slice during keyboard wait in DESQview */
  100. #endif
  101. #define CASEINDEP       0x0020                /* case independent 1-touch keys */
  102. #define RESTORECURSOR   0x0010                /* restore cursor before returning */
  103. #define CURSORON        0x0008                /* leave curson on (no hide) */
  104. #define ERASEMENU       0x0004                /* erase menu from screen on cleanup */
  105. #define DISABLENOHILITE 0x0002                /* disabled not hiliteable */
  106. #define WRAPAROUND      0x0001                /* wraparound (over top -> bottom) */
  107.  
  108.                                 /* Internal flags (don't muck with these) */
  109. #define FIRSTTIME       0x01                /* first time menu ..._get() is called */
  110.  
  111.                                 /* Command (Field) flags */
  112. #define ENABLED         0x01                /* enabled */
  113. #define DISABLED        0x02                /* disabled */
  114. #define NOTOPTION       0x04                /* not an option (static text) */
  115. #define STATICTEXT      NOTOPTION           /* not an option (static text) */
  116.  
  117. /* function prototypes */
  118. char menu_lotus(int argc, char cmdkey[], char *command[], int col[],
  119.             char *message[], int msglen[], int normal, int highlite,
  120.             int cmdrow, boolean clockon, int clockrow, int clockcol, int clockcolor);
  121.                         /* lotus slash-bar menu */
  122. void lotus_setup(int argc, byte *command[], char cmdkey[], int col[],
  123.                  byte *message[], int msglen[]);
  124.                         /* generates info needed for menu_lotus */
  125.  
  126. struct lotus_header *lotus_alloc(int argc, int cmdrow, char *command[], int cmdkey[],
  127.                                  char cmdflag[], char *message[], struct lotus_clock *clk,
  128.                                  int colnorm, int colcmdkey, int colhilite, int coldisable,
  129.                                  int coldishilite, int colmessage, int defaultcommand,
  130.                                  int spacing, unsigned flags);
  131.  
  132. int menu_popup(int left, int top, int right, int bottom, char frame[],
  133.                char *title, int titlejustify, char *command[], int cmdkey[],
  134.                char cmdflag[], int colframe, int coltitle, int colnorm,
  135.                int colcmdkey, int colhilite, int coldisable, int coldishilite,
  136.                int colnotopt, int defaultcommand, unsigned flags);
  137.  
  138. struct popup_header *popup_alloc(int left, int top, int right, int bottom, char *frame,
  139.                                  char *title, int titlejustify, char *command[], int cmdkey[],
  140.                                  char cmdflag[], int colframe, int coltitle, int colnorm,
  141.                                  int colcmdkey, int colhilite, int coldisable, int coldishilite,
  142.                                  int colnotopt, int defaultcommand, unsigned flags);
  143. int popup_get(struct popup_header *ph);     /* get menu popup choice */
  144. void popup_free(struct popup_header *ph);   /* free memory allocated by popup header */
  145. void popunlite(struct popup_header *ph);
  146. void pophilite(struct popup_header *ph);
  147. int popup_setcurrent(struct popup_header *ph, int current);     /* set current (hilited) item */
  148. void popup_restore(struct popup_header *ph);            /* restore video */
  149.  
  150. int menu_litebar(int left, int top, int right, int bottom, char *frame,
  151.                  char *title, int titlejustify, int count, char *command[], int cmdleft[],
  152.                  int cmdright[], int cmdup[], int cmddown[], int cmdkey[], char cmdflag[],
  153.                  int cmdx[], int cmdy[], char *message[], int msgx, int msgy, int argq,
  154.                  int quitkey[], int colframe, int coltitle, int colnorm, int colcmdkey,
  155.                  int colhilite, int coldisable, int coldishilite, int colnotopt,
  156.                  int colmessage, int defaultcommand, unsigned flags);
  157.  
  158. struct litebar_header *litebar_alloc(int left, int top, int right, int bottom, char *frame,
  159.                                      char *title, int titlejustify, int count, char *command[], int cmdleft[],
  160.                                      int cmdright[], int cmdup[], int cmddown[], int cmdkey[], char cmdflag[],
  161.                                      int cmdx[], int cmdy[], char *message[], int msgx, int msgy, int argq,
  162.                                      int quitkey[], int colframe, int coltitle, int colnorm, int colcmdkey,
  163.                                      int colhilite, int coldisable, int coldishilite, int colnotopt,
  164.                                      int colmessage, int defaultcommand, unsigned flags);
  165. int litebar_get(struct litebar_header *lh);
  166. void litebar_free(struct litebar_header *lh);
  167. void changelitebar(struct litebar_header *lh, struct litebar_field *lf);
  168. void liteunlite(struct litebar_header *lh);
  169. void litehilite(struct litebar_header *lh);
  170. void litemessage(struct litebar_header *lh, int len);
  171. boolean isHiliteable(char cmdtype, unsigned flagparms);
  172.  
  173. #endif              /* MENUHK_HEADER */
  174.